package com.xgkj.diyiketang.security;




/**
 * 
 * @Title: AES加密算法实现类
 * @Description:
 * @author jiayf
 * @date 2011-7-8 上午11:25:04
 * @version v1.0
 * @company 亿动科技有限公司
 */
public class EncryptAESImpl {

	public static byte[] decrypt(byte[] data, byte[] key) {
		byte[] b = null;
		try {
			b = AESCoder.decrypt(data, key);
		} catch (Exception e) {
			throw new RuntimeException("AES解密异常:" + e.getMessage());
		}
		return b;
	}

	public static byte[] encrypt(byte[] data, byte[] key) {
		byte[] b = null;
		try {
			b = AESCoder.encrypt(data, key);
		} catch (Exception e) {
			throw new RuntimeException("AES加密异常:" + e.getMessage());
		}
		return b;
	}

	public static byte[] initKey() {
		byte[] b = null;
		try {
			b = AESCoder.initKey();
		} catch (Exception e) {
			throw new RuntimeException( "初始化AES密钥异常:" + e.getMessage());
		}
		return b;
	}

}
